﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CM.BL.BE;
using System.Collections.Generic;
using CM.BL.BC;

namespace WebApp
{
    public partial class List : System.Web.UI.Page
    {
        private RfcConfigParametersBE _objConn;
        private void checkLogin()
        {
            lblErrorMsg.InnerHtml = string.Empty;
            _objConn = (RfcConfigParametersBE)Session["objConn"];
            if (_objConn == null)
            {
                Response.Redirect("Default.aspx");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            string retval = string.Empty, message = string.Empty;
            this.checkLogin();
            if (!Page.IsPostBack)
            {
                message = Request.QueryString["m"];
                List<PurchaseOrderBE> lstPO = (List<PurchaseOrderBE>)Session["lstPO"];
                if (lstPO == null || lstPO.Count == 0 || !string.IsNullOrEmpty(message))
                {
                    retval = PurchaseOrderBC.getInstance(Session.SessionID).getItemsForRelease(out lstPO);
                    Session["lstPO"] = lstPO;
                    lblErrorMsg.InnerHtml = retval.Trim();
                }
                lvpo1.DataSource = lstPO;
                lvpo1.DataBind();
                lblErrorMsg.InnerHtml = message;
            }
        }
    }
}
